<php>
//判断用户手机号码是否绑定，未绑定则无法查看，因为需手机号码才能查询相应数据
$stype = $_REQUEST['stype'];
if(empty($stype))$stype='all';
$_tmp_userinfo = M('User')->where('id='.$_SESSION['mid'])->find();
if(!empty($_tmp_userinfo)&&!empty($_tmp_userinfo['mobile'])){
	$pageData = service('Coupon')->searchByMobile($_tmp_userinfo['mobile'],$stype,true,16);
	if(empty($pageData)||empty($pageData['data'])){
	</php>
			<php>$alert_message="暂无收到的{:K('SP_COUPON_NM')}！";
				 if($stype=='used')$alert_message="暂无已使用的{:K('SP_COUPON_NM')}！";
			 	 if($stype=='unpay')$alert_message="暂无未使用的{:K('SP_COUPON_NM')}！";
			</php>
			<include file="../Public/alert_box.html" />
	<php>
	}else{
		foreach($pageData['data'] as $vo1){
			if(!in_array($vo1['order_id'],$ary_orderid))$ary_orderid[]=$vo1['order_id'];
		}
		if(!empty($ary_orderid))$ordersInfo = service('Order')->selectORelInfoByIds($ary_orderid);
		</php>
		<script type="text/javascript">
    		//鼠标移动表格效果
    		$(document).ready(function(){
		    	inittable();
		    	$('#total_no').html("{$pageData['count']}");
		    	$("#data_list").find("img").hover(
		    	        function(){
		    	        	ui.card(this);
		    	        },
		    	        function(){
		    	        	//$('#q_ui_card').fadeOut("fast");
		    	        }
		     	);
    		});
		</script>

  			<div class="list" style="margin-top:5px">
			  	<table cellspacing="0" cellpadding="0" border="0" width="100%" id="data_list">
					<tbody>
					  <tr rel="gift_title">
					  	<th style="text-align: center;" >送礼者</th>
					    <th style="text-align: center;" class="line_l">{:K('SP_COUPON_NM')}码</th>
					    <th style="text-align: center;" class="line_l">商品名称</th>
					    <th style="text-align: center;" class="line_l">商品数量</th>
					    <th style="text-align: center;" class="line_l">有效期至</th>
					    <th style="text-align: center;" class="line_l">发送时间</th>
					    <th style="text-align: center;" class="line_l">使用情况</th>
					    <th style="text-align: center;" class="line_l">操作</th>
					  </tr>
					  <volist id="vo" name="pageData['data']">
						  <tr rel="gift_{$vo['id']}">
						  		<td style="text-align: center;">
						  		<img width="25px" height="25px" rel="card" title="发送时名称：{$ordersInfo[$vo['order_id']]['sender_name']}" style="padding:1px;margin: 0px;border: 1px solid rgb(128, 152, 168); " 
			            			src="{$ordersInfo[$vo['order_id']]['order_user_id']|getUserFace='m'}" 
			            			uid="{$ordersInfo[$vo['order_id']]['order_user_id']}" curl="{:U('User://Index/usercard')}">
			            		</td>
						 		<td style="text-align: center;">{$vo['passcode']}</td>
						       	<td><a href="{:U('Product://Index/detailp',array('shelfid'=>$ordersInfo[$vo['order_id']]['shelf_id']))}">{$ordersInfo[$vo['order_id']]['goods_title']}</a></td>
						       	<td style="text-align: right;">{$vo['quantity']}&nbsp;件</td>
						       	<td style="text-align: center;">{:paramMillisecond2Date($vo['expired_date'])}</td>
						       	
						       	<td style="text-align: center;">{:paramMillisecond2Date($vo['target_date'])} - {$vo['target_hour']}时 发送</td>
						       	<td style="text-align: center;">{:getCouponStatus($vo)}</td>
						      	<td style="text-align: center;" onclick="showDetail('{$vo['id']}')"><span style="cursor: pointer;">详情</span></td>
						  </tr>
					  </volist>
					</tbody>
				  	</table>
			  </div>
			  <div id="clear"></div>
			  <div id="show_gift_page">
				  <div class="page_box">{$pageData['html']}</div>
			  </div>
<php>}
}else{</php>
	<div style="width:100%;text-align:center;margin-top:15px;">
	<php>$alert_message="此功能需通过手机号码才能查询。<a href='".U('User://Account/security')."'>点击此处</a>&nbsp;绑定手机号码！";</php>
		<include file="../Public/alert_box.html" />
	</div>
<php>}</php>

<input type="hidden" id="stype" value="{$stype}"><!-- 用于记录查看的使用情况 -->